//红外避障

bool judge = true;
void setup() {
  Serial.begin(9600);
  //  pinMode(3,INPUT);
  //  pinMode(8,OUTPUT);
  attachInterrupt(digitalPinToInterrupt(3), waring, CHANGE);
}
void loop() {
  //  int value = digitalRead(3);
  if (judge) {
    tone(8, 1000);
  } else {
    noTone(8);
  }
}

void waring() {
  judge = !judge;
//  Serial.println("emmm");
}
